<!DOCTYPE html>
<html lang="en">
<?php 
$username = $this->session->userdata('username');
?>
<head>
   <meta http-equiv="Content-Type" content="text/html" charset="utf-8">
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <meta name="description" content="">
   <meta name="keywords" content="">
   <meta name="author" content="">

   <title>E-Commerce</title>

   <link href="<?php echo base_url('assets/css/bootstrap.min.css') ?>" rel="stylesheet">
   <link href="<?php echo base_url('assets/css/font-awesome.css') ?>" rel="stylesheet">
   <link href="<?php echo base_url('assets/css/custom.css') ?>" rel="stylesheet">
   <script src="<?php echo base_url('assets/js/jquery.min.js') ?>"></script>
   <script src="<?php echo base_url('assets/js/bootstrap.min.js') ?>"></script>
   <script src="<?php echo base_url('assets/js/custom.js') ?>"></script>
   
   
</head>
<header class="navbar navbar-inverse navbar-fixed-top bs-docs-nav" role="banner" style="background-color: #253C4E;">
  <div class="container">
    <div class="navbar-header">
      <button class="navbar-toggle" type="button" data-toggle="collapse" data-target=".bs-navbar-collapse">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a href="<?php echo base_url().'index.php/produk/'?>" class="navbar-brand">LOGO E-COMMERCE</a>
    </div>
    <nav class="collapse navbar-collapse bs-navbar-collapse" role="navigation">
      <ul class="nav navbar-nav">
        <li>
          <a href="<?php echo base_url().'index.php/produk/galeri_produk/'?>">Galeri</a>
        </li>
		<li>
          <a href="<?php echo base_url().'index.php/produk/mashup/'?>">Buku</a>
        </li>
		<?
		$id_user = $this->session->userdata('id_user');
		if($id_user == 1){
		?>
		<li class="dropdown">
			<a href="#" class="dropdown-toggle" data-toggle="dropdown">Halaman Admin<b class="caret"></b></a>
			<ul class="dropdown-menu">
			  <li><a href="<?php echo base_url().'index.php/produk/tags/' ?>">Tags</a></li>
			  <li><a href="#">Something else here</a></li>
			</ul>
      </li>
      </ul>
	  <?
	  }
	  ?>
      </ul>
      <ul class="nav navbar-nav navbar-right">
	  <?php 
	  if($username){
	  ?>
	  <p style="color: white; margin-bottom: -34px;">Anda login sebagai <?php echo $username; ?></p>
		<li>
		<a href="<?php echo base_url().'index.php/log/logout/' ?>" id="btnlogout" style="padding-top: 35px; margin-left: -16px;">Logout</a>
		</li>
		
	<?php 
	} else {
	?>
        <li>
          <input id="nilai" style="display:none" value="1">
		  <a href="#" id="btnlogin" onclick="login(1);" style="margin-top: 15px;margin-left: -15px;">Login</a>
			<form action="<?php echo base_url().'index.php/log/auth/'?>" method="post" id="login" style="display:none">
				<input type="text" placeholder="Username" name="username" id="username">
				<input type="password" placeholder="Password" name="password" id="password">
				<input class="btn btn-primary" type="submit" value="Sign in" onclick="post();">
			</form>
        </li>
		
	<?php 
	}
	?>
      </ul>
    </nav>
  </div>
</header>

<script>
function post(e) {
	if($('#username').val() == 0 || $('#password').val() == 0){
		alert('username dan password anda salah!');
		event.preventDefault();
		return false;
	}
		
}

function login(nilai){ 
	if($('#nilai').val()==nilai){		
		$('#nilai').val('0'); $("#login").css("display","block");
	} else{
		$('#nilai').val('1'); $("#login").css("display","none");
	}
}
</script>
<body style="padding-top: 40px;">
